package com.isunland.managesystem.adapter;

import android.content.Context;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.TextView;
import butterknife.BindView;
import com.isunland.managesystem.R;
import com.isunland.managesystem.base.BaseMultiChoiceAdapter;
import com.isunland.managesystem.entity.AttendanceSummaryStaffDialog;
import java.util.ArrayList;
import java.util.Map;

public class SearchPersonMultipleListAdapter
    extends BaseMultiChoiceAdapter<AttendanceSummaryStaffDialog.SummaryStaff> {

  // Constructors
  public SearchPersonMultipleListAdapter(Context context,
      ArrayList<AttendanceSummaryStaffDialog.SummaryStaff> objects,
      Map<AttendanceSummaryStaffDialog.SummaryStaff, Boolean> selects) {
    super(context, objects, selects);
  }

  class ViewHolder extends BaseViewHolder {
    @BindView(R.id.tv_name_searchPerson) TextView tvNameSearchPerson;
    @BindView(R.id.tv_department_searchPerson) TextView tvDepartmentSearchPerson;

    ViewHolder(View view) {
      super(view);
    }

    @Override protected int setCheckBoxId() {
      return R.id.cb_checkApplyScale;
    }
  }

  @Override protected int getViewRootId() {
    return R.layout.adapter_add_applyscale;
  }

  @NonNull @Override public BaseViewHolder initHolder(View convertView) {
    return new ViewHolder(convertView);
  }

  @Override
  protected void init(AttendanceSummaryStaffDialog.SummaryStaff item, BaseViewHolder holder,
      int position) {
    ((ViewHolder) holder).tvNameSearchPerson.setText(item != null ? item.getName() : "");
    ((ViewHolder) holder).tvDepartmentSearchPerson.setText(item != null ? item.getDeptName() : "");
  }
}
